package com.android.gallery3d.gifdecoder;

import android.graphics.Bitmap;

import com.android.photos.data.GalleryBitmapPool;

public class GifBitmapProvider implements GifDecoder.BitmapProvider {
    private final GalleryBitmapPool mBitmapPool;

    public GifBitmapProvider() {
        this.mBitmapPool = GalleryBitmapPool.getInstance();
    }

    @Override
    public Bitmap obtain(int width, int height, Bitmap.Config config) {
        return mBitmapPool.get(width, height);
    }

    @Override
    public void release(Bitmap bitmap) {
        if (!mBitmapPool.put(bitmap)) {
            bitmap.recycle();
        }
    }
}